<?php

namespace addons\addondev\library;

use think\exception\HttpResponseException;
use think\Response;

trait DevEnvTrait
{
    protected function mustDevEnv()
    {
        $config = get_addon_config("addondev");
        if ($config['mode'] == "addons") {
            if (config('app_debug') && config("fastadmin.addon_pure_mode") === false) {
                return true;
            }
        } else {
            if (config('app_debug')) {
                return true;
            }
        }
        $content = $this->fetch("addondev/addon/check", ['mode' => $config['mode']]);
        throw new HttpResponseException(Response::create($content, 'html'));
    }
}
